package cn.bupt.adt.component;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

import cn.bupt.adt.constant.Constants;
@Component
public class DateConvert implements Converter<String, Date> {

	@Override
	public Date convert(String date) {
		DateFormat df = new SimpleDateFormat(Constants.DATE_PATTERN);
		try {
			return df.parse(date);
		} catch (ParseException e) {
			e.printStackTrace();
		}
		return null;
	}

}
